home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / compstol / cmpsttl1.lha / CompositeTool / v1.1.adoc / CompositeTool.ch.2.a < prev    next >
Encoding:
Text File  |  1990-05-08  |  10.0 KB  |  283 lines

  1. 2.1    NCSA CompositeTool
  2.  
  3.  
  4. Formatting Your Data Files    2.1
  5.  
  6. National Center for Supercomputing Applications
  7.  
  8. April 1990
  9.  
  10.                                                                 
  11.  
  12.  
  13.  
  14. 2.1    NCSA CompositeTool
  15.  
  16.  
  17. Formatting Your Data Files    2.1
  18.  
  19. National Center for Supercomputing Applications
  20.  
  21. April 1990
  22.  
  23.                                                                 
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. Chapter 2    Formatting Your Data Files
  31.  
  32.  
  33.  
  34. Chapter Overview
  35. File Formats
  36. Raw Raster Files
  37. Raw Palette Files
  38. HDF Files
  39. How NCSA CompositeTool Reads and Displays 
  40. Data Files
  41.  
  42. Chapter Overview
  43.  
  44. This chapter explains how NCSA CompositeTool reads and 
  45. displays data files. The chapter contains a detailed discussion of 
  46. the file formats readable by NCSA CompositeTool and mentions 
  47. other software packages that will enhance your use of the program.
  48.  
  49. It is especially important that you read this chapter if you plan to 
  50. load raw raster files into NCSA CompositeTool in order to ensure 
  51. that they can be read by the program.
  52.  
  53.  
  54. File Formats
  55.  
  56. NCSA CompositeTool reads files containing image data and/or 
  57. color palette information. NCSA CompositeTool can read in 
  58. datasets╤including user-defined palettes created in applications 
  59. such as NCSA PalEdit╤from raw raster or Hierarchical Data 
  60. Format (HDF) files.
  61.  
  62.  
  63. Raw Raster Files
  64. A raw raster file is a stream of raw, binary, 8 bit raster data in 
  65. row-major order. Each 8 bit byte corresponds to a pixel in the 
  66. image. The image is represented in row-major order; that is, the 
  67. first raster line appears first in the file, succeeded by the next 
  68. raster line, and so forth. Though raw raster files are easy to create, 
  69. the raw raster file format is not very flexible and therefore, not 
  70. highly recommended.
  71.  
  72. If you choose to use raw raster files to store your image data, you 
  73. must specify the dimensions of the dataset before the file can be 
  74. read by NCSA CompositeTool. The section entitled "Specifying the 
  75. Dimensions of Raw Raster Files" discusses the procedures for 
  76. specifying the dimensions of your dataset.
  77.  
  78.  
  79. Raw Palette Files
  80. A raw palette file is a stream of 768 bytes. Raw palette files can 
  81. store 256 colors, which can be selected from a palette of over 16 
  82. million possible colors. Palette files are based on the red, green, 
  83. and blue representation of color, the RGB color model. The files 
  84. consist of, in order, 256 bytes of red, 256 bytes of green, and 256 bytes 
  85. of blue. The 256 color palette entries are calculated by combining 
  86. the nth element (red), the (n+256)th element (green), and the 
  87. (n+512)th element (blue) to create the nth RGB component.
  88.  
  89. In other words, a palette file is a lookup table with 256 entries that 
  90. tell which color to associate with each of the 256 possible pixel 
  91. values. Each of the 256 palette entries in the palette is chosen from a 
  92. master palette of 224 RGB colors. Each palette entry consists of three 
  93. bytes, one each for red, green, and blue; the first red component, the 
  94. first green component, and the first blue component, for example, 
  95. comprise the first palette entry.
  96.  
  97. When you load a palette file, the hardware color table entries are 
  98. remapped according to the new palette; that is, each color in the 
  99. palette file is assigned to its corresponding entry in the hardware 
  100. color table.
  101.  
  102. NOTE:  The data values for user-defined palettes must be within 
  103. the range of 0 to 255; however, CompositeTool currently reserves 
  104. the palette values of 0 and 253╨255. Consequently, you must scale 
  105. your data in the range of 1╨252 in order to view all your data.
  106.  
  107.  
  108. HDF Files
  109. Hierarchical Data Format, or HDF, is a flexible, standard file 
  110. format designed at NCSA for sharing of graphical and floating-
  111. point data among different programs and machines. This general 
  112. purpose and extensible file format allows you to store raster 
  113. images, their dimensions, color tables, and annotations all in the 
  114. same file. In addition, you may store floating-point data, scaling 
  115. information, dimensions, annotations, and units of measurement 
  116. in a single file. HDF files are accessible from NCSA software for 
  117. the Macintosh such as NCSA ImageIP, NCSA Image, NCSA 
  118. GelReader, NCSA DataScope, NCSA PalEdit, and NCSA Layout as 
  119. well as user programs, other NCSA software, and HDF utilities. 
  120. These files can be used on such machines as the CRAY X-MP/48, 
  121. CRAY-2, Sun Workstation, IBM PC, and Alliant. The portability 
  122. and usefulness of HDF files is demonstrated in Figure 2.1.
  123.  
  124. Figure  2.1    HDF Environment
  125.  
  126.                                                                
  127.  
  128.  
  129. Why Should I Use HDF?
  130. HDF lets you store datasets with extra file information about your 
  131. data, for example, the dimensions of your image. This makes the 
  132. files easier to read and manage by programs such as NCSA 
  133. CompositeTool and saves you the trouble of tracking this 
  134. information externally.
  135.  
  136.  
  137. What Information Goes into an HDF File?
  138. Raster images can be stored in HDF files for use in NCSA 
  139. CompositeTool.
  140.  
  141. A raster image set contains a raster image, together with its 
  142. dimensions. It may also contain a palette. You may specify that the 
  143. raster image be stored in compressed or non-compressed form.
  144.  
  145.  
  146. How Do I Create an HDF File?
  147. Public domain software is available from NCSA for creating HDF 
  148. files. NCSA's HDF libraries support both Fortran and C calls on 
  149. any of the following machines:  Cray (UNICOS), Sun (UNIX), 
  150. Alliant (Concentrix), Macintosh, and IBM PC (MS-DOS).
  151.  
  152. The best way to store your data in an HDF file is to incorporate 
  153. calls to the appropriate HDF library in the program that produces 
  154. your image data. These calls can store your raw image and palette 
  155. in an HDF file in proper format.
  156.  
  157. NOTE:  If you have a UNIX-based system, you can use the 
  158. command line utility called r8tohdf to convert one or more raw 
  159. raster images and palettes to HDF format.
  160.  
  161.  
  162. Where Can I Obtain More Information about HDF?
  163. If you are connected to Internet (NSFNET, ARPANET, MILNET, 
  164. etc.) you can download HDF software and documentation at no 
  165. charge from an anonymous file transfer protocol (FTP) server at 
  166. NCSA. The steps you should follow to do so are enumerated below. 
  167. If you have any questions regarding the connection or procedure, 
  168. consult your local system administrator or network expert.
  169.  
  170. 1.    Log on to a host at your site that is connected to Internet and is 
  171. running software supporting the FTP command.
  172.  
  173. 2.    Invoke FTP on most systems by entering the Internet address of 
  174. the server:
  175.  
  176.     %  ftp  ftp.ncsa.uiuc.edu
  177.  
  178.     or
  179.  
  180.     %  ftp  128.174.20.50
  181.  
  182. 3.    Log in by entering anonymous for the name.
  183.  
  184. 4.    Enter your local login name for the password.
  185.  
  186. 5.    Enter get README.FIRST to transfer the instructions file 
  187. (ASCII) to your local host.
  188.  
  189. 6.    Enter quit to exit FTP and return to your local host.
  190.  
  191. 7.    Review the README.FIRST file for complete instructions 
  192. concerning the organization of the FTP directories and the 
  193. procedures you should follow to download the README files 
  194. specific to the application you want.
  195.  
  196. Your login session should resemble the following sample, where 
  197. the remote user's local login name is smith and user entries are 
  198. indicated in boldface type.
  199.  
  200. harriet_51%  ftp ftp.ncsa.uiuc.edu
  201. Connected to zaphod.
  202. 220 zaphod FTP server (Version 4.173 Tue Jan 31 08:29:00 CST 
  203. 1989) ready.
  204. Name (ftp.ncsa.uiuc.edu: smith):  anonymous
  205. 331 Guest login ok, send ident as password.
  206. Password:  smith
  207. 230 Guest login ok, access restrictions apply.
  208. ftp>  get README.FIRST
  209. 200 PORT command successful.
  210. 150 Opening ASCII mode data connection for README.FIRST (10283 
  211. bytes).
  212. 226 Transfer complete.
  213. local:  README.FIRST  remote:  README.FIRST
  214. 11066 bytes received in .34 seconds (32 Kbytes/s)
  215. ftp>  quit
  216. 221 Goodbye.
  217. harriet_52%
  218.  
  219.  
  220. The README.FIRST file instructs you to copy the HDF README 
  221. file to your directory and read it before proceeding. Your FTP 
  222. session should resemble the one listed below:
  223.  
  224. ftp>    cd HDF
  225. 250 CWD command successful.
  226. ftp>    get README
  227. 200 PORT command successful.
  228. 150 Opening ASCII mode data connection for README (10283 bytes)
  229. 226 Transfer complete.
  230. local:  README    remote:  README
  231. 2080 bytes received in .14 seconds (15 Kbytes/s)
  232. ftp>    quit
  233. 221 Goodbye.
  234. harriet_52%
  235.  
  236.  
  237. The HDF README file explains how to copy the contents of the 
  238. HDF directory to your home directory via remote login or 
  239. anonymous ftp. The precise file transfer procedure varies 
  240. according to the type of operating system under which you will use 
  241. HDF╤UNICOS or other.
  242.  
  243. HDF software and manuals are available for purchase╤either 
  244. individually or as part of the anonymous FTP reel or cartridge 
  245. tapes╤through the NCSA Technical Resources Catalog. Orders 
  246. can only be processed if accompanied by a check in U.S. dollars 
  247. made out to the University of Illinois. To obtain a catalog, contact:
  248.  
  249. NCSA Documentation Orders
  250. 152 Computing Applications Building
  251. 605 East Springfield Avenue
  252. Champaign, IL  61820
  253. (217) 244-0072
  254.  
  255. How NCSA CompositeTool Reads and Displays Data Files
  256.  
  257. NCSA CompositeTool assumes that all data files are to be initially 
  258. displayed as two-dimensional data, in 8 bit format, arranged in 
  259. row-major order with the origin in the upper-left corner. If the 
  260. original data was created in column-major order, as in a Fortran 
  261. program, it must be transposed to be read by the program.
  262.  
  263. 8 bit format refers to a process whereby data is scaled onto the 
  264. numerical values from 0 through 255 and is stored in single bytes, 
  265. one data element per byte. When data is displayed on the screen, a 
  266. byte is interpreted as a number from binary 0 through binary 255. 
  267. The number represents a color from the current palette. For 
  268. example, a byte that is equivalent to binary 8 is interpreted as the 
  269. ninth color in the current color palette and is displayed 
  270. accordingly.
  271.  
  272. When NCSA CompositeTool is to use a file, the application first 
  273. ascertains whether the file is an HDF file. If it is, and the file 
  274. contains a raster image, the image is loaded using the dimensions 
  275. stored in the file. The palette must be loaded as a separate step. (See 
  276. Chapter 3, the section, "Palette Frame" for more information.)
  277.  
  278. If the file is not an HDF file, the program assumes that it is a raw 
  279. raster file and that the dimensions of the dataset have been typed in 
  280. by the user in the appropriate field.
  281.  
  282.  
  283.